package com.sky.mapper;

import com.sky.annotation.AutoFill;
import com.sky.dto.CategoryDTO;
import com.sky.dto.CategoryPageQueryDTO;
import com.sky.entity.Category;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface CategoryMapper {

    //分类分页查询
    List<Category> findList(CategoryPageQueryDTO categoryPageQueryDTO);

    //新增分类
    @AutoFill("insert")
    @Insert("insert into category  values (null,#{type},#{name},#{sort},#{status},#{createTime},#{updateTime},#{createUser},#{updateUser})")
    void save(Category category);

    //删除分类-->根据主键删除
    @Delete("delete from category where id = #{id}")
    void deleteById(Long id);

    //修改分类
    @AutoFill("update")
    void update(Category category);

    //根据状态和类型查询
    List<Category> findByStatusAndType(CategoryDTO categoryDTO);
}
